include("shared.lua")
ENT.RenderGroup = RENDERGROUP_OPAQUE;

function ENT:Draw()
	self:DrawEntityOutline(0)
	self.Entity:DrawModel()

	self.STATUS = self.Entity:GetNetworkedString("STATUS")
	self.AMMOUNT = self.Entity:GetNetworkedString("AMMOUNT")
	self.ENERGY = self.Entity:GetNetworkedString("ENERGY")
	self.WATER = self.Entity:GetNetworkedString("WATER")
	
	--All of this borrowed from RD3
	
	local trace = LocalPlayer():GetEyeTrace()
	local TempY = 0;
	local pos = self.Entity:GetPos() + (self.Entity:GetUp() * (self:BoundingRadius( )+45)) + (self.Entity:GetRight() * (-self:BoundingRadius( )+70))
	local angle =  (LocalPlayer():GetPos() - trace.HitPos):Angle()
	angle.r = angle.r  + 90
	angle.y = angle.y + 90
	angle.p = 0

	local textStartPos = -375

	cam.Start3D2D(pos,angle,0.03)

		surface.SetDrawColor(0,0,0,225)
		surface.DrawRect( textStartPos, 0, 1250, 500 )

		surface.SetDrawColor(155,155,155,255)
		surface.DrawRect( textStartPos, 0, -5, 500 )
		surface.DrawRect( textStartPos, 0, 1250, -5 )
		surface.DrawRect( textStartPos, 500, 1250, -5 )
		surface.DrawRect( textStartPos+1250, 0, 5, 500 )
		TempY = TempY + 10
		
		surface.SetFont("ZpmTitle")
		surface.SetTextColor(255,255,255,255)
		surface.SetTextPos(textStartPos+15,TempY)
		surface.DrawText("ZPM Spawner")
		TempY = TempY + 70
		
		surface.SetFont("ZpmText")
		surface.SetTextColor(155,155,255,255)
		surface.SetTextPos(textStartPos+500,TempY-60)
		surface.DrawText(self.STATUS)
		TempY = TempY + 20
		surface.SetTextPos(textStartPos+15,TempY)
		surface.DrawText(self.AMMOUNT)
		TempY = TempY + 70
		surface.SetTextPos(textStartPos+15,TempY)
		surface.DrawText(self.ENERGY.."%")
		TempY = TempY + 70
		surface.SetTextPos(textStartPos+15,TempY)
		surface.DrawText(self.WATER.."%")
		TempY = TempY + 70
	--Stop rendering
	cam.End3D2D()
end
